package thread;

/**
 *java中所有的代码都是线程运行的，main方法也不例外，执行main方法的线程是主线程
 */
public class CurrentThreadDemo {
    public static void main(String[] args) {
        Thread main=Thread.currentThread();
        System.out.println("主线程是"+main);
        doSome();
        hhh();

        new Thread(){
            public void run(){
                Thread k=Thread.currentThread();
                System.out.println("这个当前线程"+k);
            }
        }.start();
    }
    public static void doSome(){
        Thread t=Thread.currentThread();
        System.out.println("主线程是"+t);
    }
    public static void hhh(){
        Thread h=Thread.currentThread();
        System.out.println("三主线程是"+h);
    }
}
